﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfComments.aspx.cs" Inherits="msBsc.WebUi.wMall.Buyer.wfComments" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>评论服务</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
   <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/from.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/pagination.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/orderlist.css" rel="stylesheet" />
    <link href="/jqPlugin/layer/skin/layer.css" rel="stylesheet" />

    <link href="/themes/wStyle1/css/Buyer/sComents.css" rel="stylesheet" />
</head>
<body>
    <div class="wf_all">
        <div id="divLoginInfo">
            <%=msBsc.WebUi.Code.QtHtmlGet.GetHeaderLoginInfo() %>
        </div>
        <div class="main-container">
            <div class="sidebar-scroll">
                <%=msBsc.WebUi.Code.QtHtmlGet.GetTouristMenuHtml() %>
            </div>
            <div class="main-Info">
                <div class="tnavigation">
                    <a class="nav" href="#">首页</a>&gt;
				<a class="nav" href="#">订单管理</a>&gt;
				<a class="nav-on" href="#">我的订单</a>
                    <div class="tinfo right">
                        <span>下单时间：<em id="ordr_time"></em></span>
                        <span>订单号:<em id="order_code"></em></span>
                    </div>
                </div>

                <div id="detailInfo">
                    <p style="width: 200px; margin-left: 30px;" class="car-price">没有任何数据信息...</p>
                </div>
                <xmp id="svc_list_temp_order" style="display: none">
                      <table class="table-info">
                        <thead class="table-head">
                            <tr>
                                <th class="w2">名称</th>
                                <th class="w2">时间</th>
                                <th>车辆价总价(元)</th>
                            </tr>
                        </thead>
                        <tbody class="user-body">
                            <tr class="tr-one">
                                <td class="w2">
                                    <div class="user-tag">
                                        <div><a href="#">{{d.rows[0].PRODUCT_NME}}</a></div>

                                    </div>
                                    <img class="car-img" alt="车辆图片" src="{{d.rows[0].IMG_URL}}" />
                                </td>
                                <td>{{getTime(d.rows[0].ORDER_START_TIME,'.')}}-{{getTime(d.rows[0].ORDER_STOP_TIME,'.')}}</td>
                                <td>
                                    <p id="price_sum" class="unit-price">￥{{d.rows[0].PRODUCT_STRIKE_PRICE}}</p>
                                    <p class="center-text">优惠 -￥<span>{{d.rows[0].DISCOUNT_AMT}}</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <input type="hidden" id="ordr_time_temp" value="{{getTime(d.rows[0].ORDER_TIME,'-')}}" />
                    <input type="hidden" id="order_code_temp" value="{{d.rows[0].ORDER_CODE}}" />
                </xmp>
                <div class="main-horizontal">
                    <div class="pictureDiv">
                        <div>
                            共<span class="picNum" id="thereNum">0</span>张，还能上传<span class="picNum" id="surplusNum">5</span>张
                        </div>
                        <div>
                            <div class="pictureImg" id="reviewP1" data-count="0">
                                +
                            </div>
                            <div class="pictureImg" id="reviewP2" data-count="0">
                                +
                            </div>
                            <div class="pictureImg" id="reviewP3" data-count="0">
                                +
                            </div>
                            <div class="pictureImg" id="reviewP4" data-count="0">
                                +
                            </div>
                            <div class="pictureImg" id="reviewP5" data-count="0">
                                +
                            </div>
                        </div>
                    </div>
                    <div class="reviewTxt">
                        <div>
                            <div>
                                <textarea class="input reviewInput" id="reviewInfo"></textarea>
                            </div>
                            <div class="message" id="reviewMessage"></div>
                        </div>
                        <div style="margin-top: 8px;">
                            <div class="camera"></div>
                            <div class="rBtn">
                                <input type="button" class="reviewBtn" onclick="addComments()" value="发布" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
    </div>
    <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
    <script src="/jqPlugin/js/jBase.js"></script>
    <script src="/jqPlugin/js/jBPage.js"></script>
    <script src="/jqPlugin/js/laytpl.js"></script>
    <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
    <script src="/themes/wStyle1/js/comm/DateInfo.js"></script>
    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <script src='/??themes/Style1/jsQt.js,jqPlugin/kindeditor/kindeditor.js,jqPlugin/kindeditor/lang/zh_CN.js,jqPlugin/js/laytpl.js,jqPlugin/layer/layer.min.js,jqPlugin/layer/extend/layer.ext.js' type='text/javascript'></script>
    
    <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
        <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>
    <script type="text/ecmascript">
        K = KindEditor;
        K.basePath = K.options.basePath = '/jqPlugin/kindeditor/';
        K.options.themesPath = K.options.basePath + 'themes/';
        K.options.langPath = K.options.basePath + 'lang/';
        K.options.pluginsPath = K.options.basePath + 'plugins/';
        function getfilequery() {
            return "&ParentId=" + $("#txtCurrDirId").val()
                                    + "&FileId=" + ""
                                    + "&RelId=" + ""
                                    + "&rType1=" + "0"
                                    + "&rType2=" + "0";
        };
        var ImageArray = new Array();
        var exCount = 0;
        $(window).load(function () {
            var editor = K.editor({
                allowFileManager: true,
                imageSizeLimit: K.undef(self.imageSizeLimit, '3MB'),
                imageUploadLimit: K.undef(self.imageUploadLimit, 5),
            });
            $('.pictureImg').click(function () {
                var vid = $(this);
                editor.uploadJson = '/pgajax.axd?F_UPLOAD=1&blSave=1&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                    + "&fType=" + "image"
                                    + getfilequery();
                editor.loadPlugin('multiimage', function () {
                    editor.plugin.multiImageDialog({
                        onClose: function () { }
                        , clickFn: function (urlList) {
                            ImageArray = new Array();
                            if (urlList.length < 1) {
                                alert(" 请选择要上传的图片,点击开始上传。");
                                return;
                            }
                            if (urlList.length == 1) {
                                $(ImageArray).each(function (i, e) {
                                    if (vid.attr('id') == e.viewid) {
                                        e.url = urlList[0].url; exCount = 1;
                                    }
                                });
                                if (exCount < 1) {
                                    ImageArray.push({ viewid: vid.attr('id'), url: urlList[0].url }); exCount = 0;
                                }
                                uploadevent(vid.attr('id'), urlList[0].url);
                            }
                            else {
                                //图片显示 存档
                                $(".pictureImg").html(" + ");
                                $(urlList).each(function (i, e) {
                                    ImageArray.push({ viewid: ("reviewP" + (i + 1)), url: e.url });
                                    uploadevent(("reviewP" + (i + 1)), e.url);
                                });
                            }

                            $("#thereNum").text(ImageArray.length);
                            $("#surplusNum").text(5 - ImageArray.length);
                            editor.hideDialog();
                        }
                    });
                });
            });
        });
       
        function btnDo(sEbtn) {
            GtGrid1Action = sEbtn;
            var opart = new jsonRow();
            opart.AddCell("orderId", GetQueryStr("orderId"));
            opart.AddCell("prid", GetQueryStr("prid"));
            opart.AddCell("ACTION", sEbtn);
            ajaxComm(opart);
        };

        $(function () {
            btnDo("BindInfo");
        })
        var status = 0;
        function bindOrderInfo(st) {
            $("#ordr_time").html($("#ordr_time_temp").val());
            $("#order_code").html($("#order_code_temp").val());
            status = st;
        }

        //添加评论
        function addComments() {
            var reviewInfo = $("#reviewInfo").val();
            if (!vfcReviewInfo(reviewInfo)) {
                return;
            }
            var urls = "";
            $(ImageArray).each(function (i, e) {
                urls += e.url + "$";
            });
            urls = urls.substring(0, urls.length - 1);
            var opart = new jsonRow();
            opart.AddCell("imgUrls", urls);
            opart.AddCell("orderId", GetQueryStr("orderId"));
            opart.AddCell("paroductId", GetQueryStr("prid"));
            opart.AddCell("Comments", reviewInfo);
            opart.AddCell("ACTION", "addComments");
            ajaxComm(opart);
        }

        //评论图片
        function uploadevent(imgId, picUrl) {
            var time = new Date().getTime();
            document.getElementById(imgId).innerHTML = "<img src='" + picUrl + "?" + time + "'/>";
        }
        //成功效果
        function success() {
            layer.alert('评论成功', 1);
            setTimeout(function () {
                window.location.href = "/wb_OrderInfo.htm?orderId=" + GetQueryStr("orderId");
            }, 2000);
        }

        //验证评论内容
        function vfcReviewInfo(reviewInfo) {

            if (IsNull(reviewInfo)) {
                $("#reviewMessage").text("*评论内容不能为空");
                return false;
            }
            reviewInfo = delHtmlTag(reviewInfo);
            if (IsNull(reviewInfo)) {
                $("#reviewMessage").text("*评论内容不能包含特殊字符。"); return;
            }
            if (!islength(reviewInfo, 0, 200)) {
                $("#reviewMessage").text("*评论内容最大只能有200个字符");
                return false;
            }
            if (ImageArray.length > 5) {
                $("#reviewMessage").text("*评论图片数量不能超过5个");
                return;
            }
            $("#reviewMessage").text("");
            return true;
        }
        function delHtmlTag(str) {
            //去掉所有的html标记
            return str.replace(/<[^>]+>/g, "");
        }
        //获取订单时间
        function getTime(t, str) {
            var time = t.split('/');
            var newtime = Array();
            newtime.push(time[0]);
            newtime.push(time[1]);
            newtime.push(time[2]);
            return newtime.join(str);
        }
    </script>
</body>
</html>
